{
  "cells": [
    {
      "metadata": {
        "trusted": true
      },
      "cell_type": "code",
      "source": "from bexk_da_sdk import bexk_da_repo\nimport joblib\nbexk_da_repo.load(\"MD:OT\", \"smart_ca_housing_md\", \"./smart_ca_housing_md.pkl\")\n# 加载模型\nmodel = joblib.load(\"./smart_ca_housing_md.pkl\")",
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "stream",
          "text": "start download remote file xdata/smart/algorithm/WS_ADS_BG00_AITEST/MD/OT/94cb804196aebf700197148aea31217a/2.0.0_20250529092156/htag/default/art/model.pkl to local /root/.da/repo/xdata/smart/algorithm/WS_ADS_BG00_AITEST/MD/OT/94cb804196aebf700197148aea31217a/2.0.0_20250529092156/htag/default/art/model.pkl\n清理动作(下载至本地[/root/.da/repo/xdata/smart/algorithm/WS_ADS_BG00_AITEST/MD/OT/94cb804196aebf700197148aea31217a/2.0.0_20250529092156/htag/default/art/model.pkl]成功)开始......\n清理动作(下载至本地[/root/.da/repo/xdata/smart/algorithm/WS_ADS_BG00_AITEST/MD/OT/94cb804196aebf700197148aea31217a/2.0.0_20250529092156/htag/default/art/model.pkl]成功)结束\n",
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "trusted": true
      },
      "cell_type": "code",
      "source": "import pandas as pd\ndef _predict(input_value):\n    X_input = pd.DataFrame([input_value])\n    # 预测\n    prediction = model.predict(X_input)\n    return prediction[0].tolist()[0]\n",
      "execution_count": 6,
      "outputs": []
    },
    {
      "metadata": {
        "trusted": true
      },
      "cell_type": "code",
      "source": "print(_predict({\n        \"MEDINC\": 2.3886,\n        \"HOUSE_AGE\": 16.0,\n        \"AVE_ROOMS\": 5.254716981132075,\n        \"AVE_BEDRMS\": 1.1622641509433962,\n        \"AVE_OCCUP\": 2.616981132075472,\n        \"LATITUDE\": 39.37,\n        \"LONGITUDE\": -121.24,\n        \"POPULATION\": 1387.0\n    }))",
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "stream",
          "text": "0.5183420605965523\n",
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "trusted": true
      },
      "cell_type": "code",
      "source": "",
      "execution_count": null,
      "outputs": []
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "version": "3.6.5",
      "mimetype": "text/x-python",
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "pygments_lexer": "ipython3",
      "nbconvert_exporter": "python",
      "file_extension": ".py"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}